import Vue from 'vue'
import VueRouter from 'vue-router'
import PATH from './constant'

Vue.use(VueRouter)

const routes = [
  {
    path: PATH.HOME,
    name: 'Home',
    component: () => import ('../views/Home.vue'),
    meta: {
      isShowNav: false,
      isShowNavBack: false,
      isShowTab: true
    }
  },
  {
    path: PATH.CLASSIFY,
    name: 'classify',
    component: () => import('../views/Classify.vue'),
    meta: {
      isShowNav: false,
      isShowNavBack: false,
      isShowTab: true
    }
  },
  {
    path: PATH.GOODSLIST,
    name: 'goodsList',
    component: () => import('../views/classify/GoodsList.vue'),
    meta: {
      isShowNav: true,
      isShowNavBack: true,
      title: '分类商品',
      isShowTab: false
    }
  },
  {
    path: PATH.CART,
    name: 'cart',
    component: () => import('../views/Cart.vue'),
    meta: {
      isShowNav: true,
      isShowNavBack: false,
      isShowSelect: true,
      title: "购物车",
      isShowTab: true
    }
  },
  {
    path: PATH.MINE,
    name: 'mine',
    component: () => import('../views/Mine.vue'),
    meta: {
      isShowNav: false,
      isShowNavBack: false,
      isShowTab: true
    }
  },
  {
    path: PATH.ADDRESS,
    name: 'address',
    component: () => import('../views/mine/Adress.vue'),
    meta: {
      isShowNav: true,
      isShowNavBack: true,
      title: "我的地址",
      isShowTab: false
    }
  },
  {
    path: PATH.LOGIN,
    name: 'login',
    component: () => import('../views/mine/Login.vue'),
    meta: {
      isShowNav: false,
      isShowNavBack: false,
      isShowTab: false
    }
  },
  {
    path: PATH.ENROLL,
    name: 'enroll',
    component: () => import('../views/mine/Enroll.vue'),
    meta: {
      isShowNav: false,
      isShowNavBack: false,
      isShowTab: false
    }
  },
  {
    path: PATH.BARGAINALL,
    name: 'bargainAll',
    component: () => import('../views/home/BargainAll.vue'),
    meta: {
      isShowNav: true,
      isShowNavBack: true,
      title: "砍价列表",
      isShowTab: false
    }
  },
  {
    path: PATH.NEWSALL,
    name: 'newsAll',
    component: () => import('../views/home/NewsAll.vue'),
    meta: {
      isShowNav: true,
      isShowNavBack: true,
      title: "严选专栏",
      isShowTab: false
    }
  },
  {
    path: PATH.NEWSDATA,
    name: 'newsData',
    component: () => import('../views/home/NewsData.vue'),
    meta: {
      isShowNav: true,
      isShowNavBack: true,
      title: "专栏详情",
      isShowTab: false
    }
  },
  {
    path: PATH.GOODSDATA,
    name: 'goodsData',
    component: () => import('../views/home/GoodsData.vue'),
    meta: {
      isShowNav: false,
      isShowNavBack: false,
      isShowTab: false
    }
  },
  {
    path: PATH.GOODSALL,
    name: 'goodsAll',
    component: () => import('../views/home/GoodsAll.vue'),
    meta: {
      isShowNav: true,
      isShowNavBack: true,
      title: "人气推荐",
      isShowTab: false
    }
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
